/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.plugins.add('footnote',
{		
	init: function(editor)
	{
		if ( CKEDITOR.env.ie6Compat )
			return;
		
		var pluginName = 'footnote';
		
		//Register the command. 
		editor.addCommand(pluginName, new CKEDITOR.dialogCommand(pluginName));
		
		//Register the toolbar button.
		editor.ui.addButton('Footnote',
				{
					label: 'Footnote or Citation',
					command: pluginName,
					//I want to use Icon, but still now is not available
					icon : this.path + 'uicolor.gif'
				});
		//Register corresponding dialog
		CKEDITOR.dialog.add(pluginName, this.path + 'dialogs/footnote.js');
		
		// If the "menu" plugin is loaded, register the menu items.
		
		if( editor.addMenuItems)
		{
			editor.addMenuItems(
				{
					insertCode: //name of the menu item
						{
							label: 'LysFootnote',
							command: 'insertCode',
							group: 'insertCode'
						}
				} );
		}
		
		// If the "contextmenu" plugin is loaded, register the listeners.
		if( editor.contextMenu)
		{
			editor.contextMenu.addListener(function(element, selection) //function to be run when context menu is displayed
				{
					if( !element)
						return null;		
						
					return {
						insertCode: CKEDITOR.TRISTATE_OFF
					};
						
				} );		
		}
		
	}
} );

